package com.zh.web.clients;

import com.zh.web.bean.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "idGenerator")
public interface IdClient {
    /**
     * 获取单个 ID
     * GET /next
     */
    @GetMapping("/id/next")
    ResponseResult getNextId();

    /**
     * 获取批量 ID
     * GET /batch?size=xxx
     */
    @GetMapping("/id/batch")
    ResponseResult getBatchIds(@RequestParam("size") int size);

    /**
     * 解析时间戳
     * GET /parse/time?id=xxx
     */
    @GetMapping("/id/parse/time")
    ResponseResult parseIdToTime(@RequestParam("id") long id);

    /**
     * 解析数据中心 ID
     * GET /parse/datacenter?id=xxx
     */
    @GetMapping("/id/parse/datacenter")
    ResponseResult parseIdToDatacenterId(@RequestParam("id") long id);

    /**
     * 解析工作节点 ID
     * GET /parse/worker?id=xxx
     */
    @GetMapping("/id/parse/worker")
    ResponseResult parseIdToWorkerId(@RequestParam("id") long id);
}
